package com.zyk.leetcode;

/**
 * @author zhangsan
 * @date 2021/4/15 17:11
 */
public class C551 {

    // https://leetcode-cn.com/problems/student-attendance-record-i/
    public static boolean checkRecord(String s) {
        char[] str = s.toCharArray();
        boolean flag1 = true;
        for (int i = 0; i < str.length; i++) {
            if (str[i] == 'A') {
                if (!flag1) return false;
                flag1 = false;
            } else if (str[i] == 'L')
                if (i - 2 >= 0 && str[i - 1] == 'L' && str[i - 2] == 'L') return false;
        }
        return true;
    }


    // for test
    public static void main(String[] args) {
        String str = "PPALLL";
        System.out.println(checkRecord(str));
    }

}
